function initMetrologyLib(basedir)
%INITMETROLOGYLIB Initialise the CamBar metrology system by means of metrolib.dll.
%   Initialises the CamBar metrology system by means of metrolib.dll. This
%   is sometimes necessary because it is not known how initialising the
%   flash controller has to be done. Functionality for that is included in
%   the proprietary metrolib.dll.
%
%   Initialisation is done via an x86 EXE binary, as metrolib.dll is only
%   available in a x86 version.
%
% Arguments:
%   basedir:    directory which initMetrologyLib.exe is located in

DLL_PATH = fullfile(basedir, '..', '..', 'libs', 'x86');
setenv('PATH', [getenv('PATH'), ';', DLL_PATH]);

[status, result] = system('initMetrologyLib.exe');
fprintf('%s\n', result);

if status == 1
    error('No measurement systems found.');
end
